package com.wzk.travelspringboot.controller;

import com.wzk.travelspringboot.dto.Result;
import com.wzk.travelspringboot.service.ScenicTypeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;

/**
 * @Author: WangZiKang
 * @Date: 2025/1/6 22:05
 */
@Slf4j
@RestController
@RequestMapping("/type")
@RequiredArgsConstructor
@Validated
public class ScenicTypeController {

    private final ScenicTypeService scenicTypeService;

    @GetMapping("/all")
    public Result getAll(){
        return scenicTypeService.getAllType();
    }

    @GetMapping("/add/{typeName}")
    public Result addType(@PathVariable(name = "typeName") @NotBlank String typeName){
        return scenicTypeService.insertType(typeName);
    }

}
